home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Musik / Misc / Amster / Source / info.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-01  |  2.1 KB  |  98 lines

  1. /*
  2. ** Information
  3. */
  4.  
  5. #include "include/config.h"
  6.  
  7. #include <stdio.h>
  8. #include <stdarg.h>
  9. #include <stdlib.h>
  10. #include <string.h>
  11.  
  12. #include "include/mui.h"
  13. #include <MUI/NListview_mcc.h>
  14.  
  15. #include "include/gui.h"
  16. #include "include/info.h"
  17. #include "include/panel.h"
  18. #include "amster_Cat.h"
  19.  
  20. ULONG info_new(struct IClass *cl, Object *obj, struct opSet *msg);
  21.  
  22.  
  23. MUIF info_dispatch(REG(a0) struct IClass *cl,REG(a2) Object *obj,REG(a1) Msg msg)
  24. {
  25.     switch(msg->MethodID) {
  26.         case OM_NEW: return(info_new(cl,obj,(APTR)msg));
  27.         case INFO_MSG:
  28.             {
  29.             struct infodata *data = INST_DATA(cl, obj);
  30.  
  31.             DoMethod(data->msglist, MUIM_NList_InsertSingle, (char *)((muimsg)msg)->arg1, MUIV_NList_Insert_Bottom);
  32.             set(data->msglist, MUIA_NList_First, MUIV_NList_Active_Bottom);
  33.  
  34.             return(NULL);
  35.             }
  36.     }
  37.     return(DoSuperMethodA(cl,obj,msg));
  38. }
  39.  
  40.  
  41. ULONG info_new(struct IClass *cl, Object *obj, struct opSet *msg)
  42. {
  43.     struct infodata *data;
  44.     Object *msglist,*clrbut;
  45.  
  46.     if (obj = (Object *)DoSuperNew(cl,obj,
  47.         MUIA_HelpNode, "info",
  48.         WindowContents, VGroup,
  49.             Child, NListviewObject,
  50.                 MUIA_NListview_NList, msglist = NListObject,
  51.                     ReadListFrame,
  52.                     MUIA_NList_Input, FALSE,
  53.                     MUIA_NList_AutoCopyToClip, TRUE,
  54.                     MUIA_NList_TypeSelect, MUIV_NList_TypeSelect_Char,
  55.                     MUIA_NList_ConstructHook, MUIV_NList_ConstructHook_String,
  56.                     MUIA_NList_DestructHook, MUIV_NList_DestructHook_String,
  57.                     MUIA_NList_AutoVisible, TRUE,
  58.                 End,
  59.             End,
  60.             Child, HGroup,
  61.                 Child, HSpace(0),
  62.                 Child, clrbut = SimpleButton(MSG_INFO_CLEAR),
  63.             End,
  64.         End,
  65.         TAG_MORE, msg->ops_AttrList))
  66.     {
  67.         data = INST_DATA(cl,obj);
  68.         data->msglist = msglist;
  69.  
  70.         set(obj,MUIA_Window_ID,MAKE_ID('I','N','F','O'));
  71.         set(obj,MUIA_Window_Title,MSG_INFO_TITLE),
  72.  
  73.         DoMethod(obj,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,gui->iconpanel,1,PANEL_CLOSEDEBUG);
  74.         DoMethod(clrbut,MUIM_Notify,MUIA_Pressed,FALSE,msglist,1,MUIM_NList_Clear);
  75.  
  76.         return((ULONG)obj);
  77.     }
  78.     return(0);
  79. }
  80.  
  81.  
  82. void gui_debug(char *msg)
  83. {
  84.     DoMethod(gui->iwin, INFO_MSG, msg);
  85. }
  86.  
  87.  
  88. void gui_debugf(char *msg, ...)
  89. {
  90.     static char buf[1024];
  91.     va_list ap;
  92.  
  93.     va_start(ap,msg);
  94.     vsprintf(buf,msg,ap);
  95.     va_end(ap);
  96.     gui_debug(buf);
  97. }
  98.